﻿#ifndef _CTOTRISGAME_H_
#define _CTOTRISGAME_H_

#include "../basic/CList.h"
#include "CSparePart.h"
#include "MiscDefine.h"

#ifdef __cplusplus
extern "C" {
#endif

#define TOS_OVERLAP             1
#define TOS_NOT_OVERLAP         2
#define TOS_OVERLAP_ERROR       -1

typedef struct _ctotris_game_ {
	//attribute
	char** piles;
	CList users;
	int st;

	//action
} CTotrisGame;

int construct_toris_game(CTotrisGame* thes);
//int add_user()

int is_overlap_spare_part(const CSparePart* p1, const CSparePart* p2);
int is_overlap_piles(const CSparePart* p1, const char* piles);
int is_need_pile(const CSparePart* p, const char* piles);
int do_pile(const CSparePart* p, char* piles);
int is_have_full_row(const char* piles, char which_row[ITEM_HEIGHT_COUNT], int* count);
int do_erase_full_row(char* piles, char row_num);
#ifdef __cplusplus
}
#endif
#endif
